package graphics.operations;

import graphics.Cerchio;

import java.awt.Graphics;
import java.awt.event.MouseEvent;

public class AddCerchioOperation extends Operation{

	private Cerchio cerchio;
	private int xStart;
	private int yStart;
	
	
	public void mousePressed(MouseEvent arg0) {
		//Errore Cerchio cerchio=new Cerchio(); 
		cerchio=new Cerchio();
		cerchio.setR(5);
		cerchio.setX(arg0.getX());
		cerchio.setY(arg0.getY());
		xStart=arg0.getX();
		yStart=arg0.getY();
		getData().addForma(cerchio);
		getData().aggiorna();
	}
	
	
	public void mouseClicked(MouseEvent arg0) {
		//Do nothing
	}
	
	
	public void mouseDragged(MouseEvent arg0) {
		int x=arg0.getX();
		int y=arg0.getY();
		cerchio.setR((int)Math.sqrt( (x-xStart)*(x-xStart)+(y-yStart)*(y-yStart) ));
		getData().aggiorna();
	}
	
	
	public void mouseEntered(MouseEvent arg0) {
		//Do nothing
	}
	
	
	public void mouseExited(MouseEvent arg0) {
		//Do nothing
	}
	
	
	public void mouseMoved(MouseEvent arg0) {
		//Do nothing
	}
	
	
	public void mouseReleased(MouseEvent arg0) {
		//Do nothing
	}
	
	
	public void drawOperationInfo(Graphics graphics) {
		//Do nothing
	}
}
